package com.duanjw.springframework.beanname;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * beanName测试
 * 1. 默认beanName是并将类名第一个字符转换为小写
 * 2. 如果类名第一个字符和第二个字符都是大写，那么beanName会保留原样
 * 3. 如果类名首字符是小写，那么beanName保留原样
 *
 * @author duanjw
 */
public class BeanNameApplication {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);

        for (String beanDefinitionName : applicationContext.getBeanDefinitionNames()) {
            System.out.println(beanDefinitionName);
        }
    }
}

@Configuration
@ComponentScan("com.duanjw.springframework.beanname")
class AppConfig {


}